Create devices for the xenbus-bus's.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 19:04:47 +0000 (19:04 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 19:04:47 +0000 (19:04 +0000)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c

index 331ef7f150fb7e166a3f475661a23de130ca9949..3a37014c0b6fb470d615a8fa92021f87fcd259fc 100644 (file)
@@ -72,6 +72,7 @@ struct xen_bus_type
        int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename);
        int (*probe)(const char *type, const char *dir);
        struct bus_type bus;
+       struct device dev;
 };
 
 /* device/<type>/<id> => <type>-<id> */
@@ -103,6 +104,9 @@ static struct xen_bus_type xenbus_frontend = {
                .name  = "xen",
                .match = xenbus_match,
        },
+       .dev = {
+               .bus_id = "xen",
+       },
 };
 
 /* For backends, does lookup on uuid (up to /).  Returns domid, or -errno. */
@@ -160,6 +164,9 @@ static struct xen_bus_type xenbus_backend = {
                .name  = "xen-backend",
                .match = xenbus_match,
        },
+       .dev = {
+               .bus_id = "xen-backend",
+       },
 };
 
 static int xenbus_dev_probe(struct device *_dev)
@@ -304,16 +311,17 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
        xendev->subtype = xenbus_read(xendev->nodename, "subtype", NULL);
        if (IS_ERR(xendev->subtype))
                xendev->subtype = NULL;
-       
+
+       xendev->dev.parent = &bus->dev;
+       xendev->dev.bus = &bus->bus;
+       xendev->dev.release = xenbus_release_device;
+
        err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename);
        if (err) {
                kfree(xendev);
                return err;
        }
 
-       xendev->dev.bus = &bus->bus;
-       xendev->dev.release = xenbus_release_device;
-
        /* Register with generic device framework. */
        err = device_register(&xendev->dev);
        if (err) {
@@ -584,6 +592,8 @@ static int __init xenbus_probe_init(void)
 {
        bus_register(&xenbus_frontend.bus);
        bus_register(&xenbus_backend.bus);
+       device_register(&xenbus_frontend.dev);
+       device_register(&xenbus_backend.dev);
        
        if (!xen_start_info.store_evtchn)
                return 0;